Building LIGGGHTS

Metadata
aliases: []
shorthands: {}
created: 2021-10-26 20:40:10
modified: 2022-01-10 04:13:04

These apply for Apple Silicon macs as of 2021.
(Official guide)

Requirements

First requirement is to build VTK with MPI support. This is crucial to be able to export the simulation details into VTK files and then be able to view them is ParaView. The requirements of VTK are also needed here.
For superquadratics, boost, and boost-mpi has to be installed for MPI support via brew:

brew install boost
brew install boost-mpi

First step is to clone the public version of LIGGGHTS from GitHub:

git clone https://github.com/CFDEMproject/LIGGGHTS-PUBLIC.git
cd LIGGGHTS-PUBLIC/src

Then generate the auto makefiles:

make auto

Then edit the config file with the name src/MAKE/Makefile.user the following way:

  1. Make sure that MPI and VTK are turned on
  2. Set include and lib directories for VTK (the directories usually can be found in /usr/local) and make sure to uncomment the corresponding lines
  3. Only set the VTK appendix if needed
  4. Set the boost include directory (it is found in brew's usual install location)

Then just run make again:

make auto

Now the compiler might show an error in ../utils.h:

../utils.h:70:12: error: non-const lvalue reference to type 'basic_ostringstream<...>' cannot bind to a temporary of type 'basic_ostringstream<...>'
    return static_cast< std::ostringstream & >(( std::ostringstream() << std::dec << a ) ).str();

This should get fixed in the source code just by replacing the single line in the corresponding function from

return static_cast< std::ostringstream & >(( std::ostringstream() << std::dec << a ) ).str();

To

std::ostringstream strs;
strs << a;
std::string str = strs.str();
return str;

Then by running make build again, the software build without problems.

Finally, make a symbolic link for the binary to /usr/local/bin.

Running an example

The first given example in the official guide can be ran like this:

cd src
make auto
cp lmp_auto ../examples/LIGGGHTS/Tutorials_public/chute_wear
cd ../examples/LIGGGHTS/Tutorials_public/chute_wear
mpirun -np 4 lmp_auto < in.chute_wear

Then the output vtk files can be opened and visually viewed in ParaView.